IF (CMAKE_VERSION VERSION_LESS 3.0)
  PROJECT(TDengine CXX)
  SET(PROJECT_VERSION_MAJOR "${LIB_MAJOR_VERSION}")
  SET(PROJECT_VERSION_MINOR "${LIB_MINOR_VERSION}")
  SET(PROJECT_VERSION_PATCH "${LIB_PATCH_VERSION}")
  SET(PROJECT_VERSION "${LIB_VERSION_STRING}")
ELSE ()
  CMAKE_POLICY(SET CMP0048 NEW)
  PROJECT(TDengine VERSION "${LIB_VERSION_STRING}" LANGUAGES CXX)
ENDIF ()

IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  CMAKE_MINIMUM_REQUIRED(VERSION 2.8...3.20)
ELSE ()
  CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
ENDIF ()

SET(TD_ACCOUNT FALSE)
SET(TD_ADMIN FALSE)
SET(TD_GRANT FALSE)
SET(TD_MQTT FALSE)
SET(TD_TSDB_PLUGINS FALSE)
SET(TD_STORAGE FALSE)
SET(TD_TOPIC FALSE)
SET(TD_MODULE FALSE)

SET(TD_COVER FALSE)
SET(TD_MEM_CHECK FALSE)

SET(TD_PAGMODE_LITE FALSE)
SET(TD_SOMODE_STATIC FALSE)
SET(TD_GODLL FALSE)

SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "Community directory: " ${TD_COMMUNITY_DIR})

INCLUDE(cmake/input.inc)
INCLUDE(cmake/platform.inc)

IF (TD_WINDOWS OR TD_DARWIN) 
  SET(TD_SOMODE_STATIC TRUE)
ENDIF ()

INCLUDE(cmake/define.inc)
INCLUDE(cmake/env.inc)
INCLUDE(cmake/version.inc)
INCLUDE(cmake/install.inc)

ADD_SUBDIRECTORY(deps)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(tests)

INCLUDE(CPack)
